<template>
    <div>
        <subcate :data='catelist' :cid='course.cid' @scid='getcid'/>
        <van-field v-model="course.name" label="名称" />
       <van-field v-model="course.description" label="描述" />
       <van-field v-model="course.tname" label="讲师" />
       <van-image :src="course.pic" width='100' height=100 />
       <video :src='"http://localhost:5000/static/upload/"+i' controls="controls" v-for='i in videos' width=300 height=200>{{i}}</video>
       <br>
       <van-button @click="update">修改</van-button>
    </div>
</template>

<script>
import subcate from '@/components/try/subcate'
    export default {
        components:{
            'subcate':subcate
        },
        data(){
            return{
                id:this.$route.query.id,
                course:{},
                catelist:[],
                videos:''
            }
        },
        methods:{
          get_catelist(){
                this.$axios.get('upload').then(res=>{
                    this.catelist = res.data.list
                })
            },
          getcourse(){
              this.$axios.get('courss?id='+this.id).then(res=>{
                  this.course = res.data.course
                  this.videos = JSON.parse(res.data.course['vedios'])
              })
          },
          getcid(id){
            alert(id)
        },
        update(){

        }
    },
    mounted(){
        this.get_catelist()
        this.getcourse()
    }
    }
</script>

<style scoped>

</style>